package cn.kgc.appinfo.controller;

import cn.kgc.appinfo.entity.AppCategory;
import cn.kgc.appinfo.service.AppCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/app_category")
public class AppCategoryController {

    @Autowired
    private AppCategoryService appCategoryService;

    @ResponseBody
    @RequestMapping("/query_category/{parentId}")
    public List<AppCategory> queryAppCategoryByParentId(@PathVariable() Integer parentId){
        System.out.println(parentId);
        List<AppCategory> appCategories = appCategoryService.selectAppCategoryByParentId(parentId);
        System.out.println(appCategories);
        return appCategories;
    }
}
